import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Button } from 'antd'
import './homeData.less'

class HomeData extends Component {
  componentDidMount = () => {
    const { dispatch } = this.props
    dispatch({
      type: 'getAsyncData'
    })
  }
  getData = () => {
    const { dispatch } = this.props
    dispatch({
      type: 'getAsyncData',
    })
  }
  render () {
    return (
      <div className="home-data">
        <Button onClick={this.getData}>获取异步数据</Button>
      </div>
    )
  }
}

function mapStateToProps(state) {
  return {}
}
export default connect(mapStateToProps)(HomeData)